/**
 *
 */
package com.rexzhaolei.fizzbuzzwhizz;

/**
 * @author rex.zhao
 *
 */
public class Fizz extends Zz {

	public Fizz(int sp) {
		super(sp);
	}

	public Fizz(int sp, Zz zz) {
		super(sp, zz);
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see com.rexzhaolei.fizzbuzzwhizz.Zz#message(int)
	 */
	@Override
	public String message(int no) {
		if (filter(no)) {
			// 数字中包含特殊数字的
			return say();
		} else {
			return super.message(no);
		}
	}

	@Override
	protected String say() {
		return "Fizz";
	}

	private boolean filter(int no) {
		while (no > 0) {
			if ((no % 10) == getSp()) {
				return true;
			}
			no /= 10;
		}

		return false;
	}
}
